<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 王宇航
  Date: 2023/4/8
  Time: 10:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>商品列表页面</title>
    <script>
        function del(){
            return confirm("是否删除？");
        }
    </script>
</head>
<body style="text-align: center">
<h1 style="color: aqua">商品列表页面</h1>
<a href="/admin/addProduct.jsp">添加商品</a>
<table border="1" style="margin: auto">
    <tr>
        <th>ID</th>
        <th>商品名称</th>
        <th>商品描述</th>
        <th>商品原价</th>
        <th>商品现价</th>
        <th>商品类型</th>
        <th>商品图片</th>
        <th colspan="3">操作</th>
    </tr>
    <c:forEach var="product" items="${sessionScope.pagination.list}">
        <tr>
            <td>${product.id}</td>
            <td>${product.title}</td>
            <td>${product.details}</td>
            <td>${product.orginal_price}</td>
            <td>${product.current_price}</td>
            <td>${product.type}</td>
            <td><img width="200px" height="auto" src="/static/images/product/${product.picture}"></td>
            <td><a href="/product/editer_queryById/${product.id}">编辑</a></td>
            <td><a href="/product/detailProduct/${product.id}">详情</a></td>
            <td><a href="/product/removeProduct/${product.id}" onclick="return del()">删除</a></td>
        </tr>
    </c:forEach>
</table>
<c:import url="../page.jsp">
   <c:param name="path" value="product/${sessionScope.pagination.sqlId}"/>
</c:import>
<br>
<a href="/admin/index.html">返回上一页面</a>
</body>
</html>
